-- promote_skill
-- created by dengc
-- promote_skill(2206)
-- 提升技能XX的效果

return {
    apply = function(source, target, skillId, round, para, extra)
        local addon = 0;
        local value = 0;
        local improve = source.dbase:queryTemp("promote_skill") or {};

        -- 魔法抗性
        local resistProp = PropM.combine(source, "resist", "magic");

        -- 自然之力加成
        local prop = PropM.combine(source, "promote_vine_shield", "1");
        addon = PropM.apply(prop, addon);

        -- 魔抗满值为100
        local magic = resistProp[3];
        if magic < 1000 then
            value = PropM.apply(prop, 0);
            table.insert(improve, { ["prop_id"] = resistProp[1], ["value"] = value, });

            -- 记录
            PropM.record(source, {resistProp[1], resistProp[2], addon, resistProp[4]}, "skill");
        end        

        -- 物理反伤
        addon = 0;
        value = 0;
        local reflexProp = PropM.combine(source, "reflex_damage", "1");

        -- 自然之力加成
        addon = PropM.apply(prop, addon);
        value = PropM.apply(prop, 0);
        table.insert(improve, { ["prop_id"] = reflexProp[1], ["value"] = value, });

        -- 记录
        PropM.record(source, {reflexProp[1], reflexProp[2], addon, reflexProp[4]}, "skill");

        source.dbase:setTemp("promote_skill", improve);

        -- 作用目标
        return { target, };
    end,

    parse = function(desc)
        local arr = string.explode(desc, ",");
        return { tonumber(arr[1]) };
    end,

    -- 解析技能描述
    parseDesc = function(source, skillId, desc, para)
        return desc;
    end,
};
